#ifndef _BASIS_IMAGE_H_
#define _BASIS_IMAGE_H_

#include "rgb.h"
#include <iostream>
#include <string>
using namespace std;

class Image
{
public:
	Image();
	Image(int width, int height);
	Image(int width, int height, rgb background);
	~Image();

	//	return false if x or y is out of bound
	bool set(int x, int y, const rgb &color);
	bool get(int x, int y, rgb &color, float scale = 1.0f);
	rgb getPixel(int x, int y);
	void gammaCorrect(float gamma);

	void writePPM(ostream& out);
	void readPPM(string file_name);

	int getWidth();
	int getHeight();

private:
	rgb** raster;
	int nx;	// raster width
	int ny;	// raster height

};

#endif